Core Concepts
This page is a slightly unorganised list of stuff you'll need to know while doing the other tasks.
UML diagrams
Preface
The following is a simple explanation of the UML diagram "box". You'll learn enough to read the diagrams, but I suggest that you do some good old Googling in regards to the different arrows and such.
Example
A example of a class may look like this:
IdentifiableObject |
---|
-_identifiableObject:List<string> |
+identifiableObject(string[] idents) +AreYou(string id): bool +FirstId: string <<readonly property>> +Addidentifier(string id) |
The following is a line-by-line breakdown of that class:
Class name (Surely I don't need to explain this) |
---|
Minus means private. This part essentially creates a new variable called _identifiers with type List<string> |
Plus means public, the name is IdentifiableObject As this is a method, we have the brackets. Inside of the brackets we have string[] idents . string[] is treated as a data type such as int .--- Another public method, this one is called “AreYou”. The type of this method is “bool”, and we’re using a variable called “id” which is a string, so we’d write: public bool AreYou(string id) As it’s a Boolean, it MUST return true or false in some way. --- This is a public PROPERTY, so we do not have brackets (it’s not a method). In this case, it is a string and read only. This is formed as: Public string FirstId{} Inside the brackets is where we would have our get{} (and set{} if it wasn't readonly) code. Properties MUST return a value of some sort.--- This one is similar to AreYou(string id), but does not require a returned value as it’s just a method. It is public (due to the plus), and has the parameter “id” that is a string. |
Example (diagram/image variant)
UML Sequence Diagrams
Another aspect of the UML diagrams the sequence diagrams. More details about those here
Unit Testing
For unit testing, use NUnit. If you use something else, I can't support you. Sorry.
Setting up the unit tests can be a little messy, but there are some decent YouTube guides out there. I personally suggest this one:
Common mistakes
Some common mistakes I see is not adding the reference project. The following GIF will show you how I do this:
Assertions
I personally use Assert.That()
to run virtually all my unit tests. You can use other options like Assert.AreEqual()
if you like. With the right syntax, they're virtually the same. An example of one of my tests is:
Assert.That(SomeObject.SomeProperty(OtherObject.SomeValue),Is.EqualTo("The string output I expected");)
Now obviously that wasn't one of my actual tests, but you get the point.